class Solution {
    public int massage(int[] nums) {
        //1.创建dp表
        int m = nums.length;
        int[] dp = new int[m+3];
    
        //2.初始化
        dp[0] = dp[1] = dp[2] = 0;

        //3.填表
        for(int i = 3; i < m+3; i++) {
            dp[i] = Math.max(dp[i-2], dp[i-3]) + nums[i-3];
        }

        //4.返回值
        return Math.max(dp[m+2], dp[m+1]);
    }
}
